package com.example.questionnaire.shiro;

import org.apache.shiro.authc.AuthenticationToken;

/**
 * 把Shiro默认的Token改为JWT
 */
public class JWTToken implements AuthenticationToken {

//    private String username;
//    private char[] password;
//    private boolean rememberMe;
//    private String host;

    //以下相当于重写shiro框架自带的token
    private String token;
//    public JWTToken(String token){
//        this.token = token;
//    }
//    public JWTToken(String token,String username,String password){
//        this.rememberMe = false;
//        this.username = username;
//        this.password = (char[])(password != null ? password.toCharArray() : null);
//        this.rememberMe = false;
//        this.host = null;
//        this.token = token;
//    }

    public JWTToken(String token){
        this.token = token;
    }

//    public JWTToken(String username,String password){
//        this.rememberMe = false;
//        this.username = username;
//        this.password = (char[])(password != null ? password.toCharArray() : null);
//        this.rememberMe = false;
//        this.host = null;
//    }

    @Override
    public Object getPrincipal() {
        return token;
    }

    @Override
    public Object getCredentials() {
        return token;
    }

//    public void setRememberMe(boolean rememberMe) {
//        this.rememberMe = rememberMe;
//    }
//
//    @Override
//    public boolean isRememberMe() {
//        return this.rememberMe;
//    }
}
